package com.auto.qinglong.utils

import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.NavHostController

/**
 * Created by YuanWei1 on 2025/6/3.
 *
 * Description:
 */
/**
 * Destinations used in the [JetnewsApp].
 */
object QlDestinations {
    /**
     * Home Route
     * 首页路由
     */
    val HOME_ROUTE: String = "ql_home"

    /**
     * Setting
     * 设置页
     */
    val SETTING: String = "ql_setting"

    /**
     * 登录
     */
    val LOGIN: String = "ql_login"

    /**
     * 登录
     */
    val TASK_LOG: String = "TASK_LOG"
}

class QlNavigationActions(val navController: NavHostController) {
    fun navigateToHome() {
        navController.navigate(QlDestinations.HOME_ROUTE) {
            popUpTo(navController.graph.findStartDestination().id) {
                saveState = true
            }
            launchSingleTop = true
        }
    }

    fun navigateToSetting() {
        navController.navigate(QlDestinations.SETTING)
    }

    fun navigateToLogin() {
        navController.navigate(QlDestinations.LOGIN)
    }
}